using UnityEngine;

public class TankTrack : MonoBehaviour
{
	public Transform frontWheel;

	public Transform rearWheel;

	private Transform _tmp;

	private Transform tmp
	{
		get
		{
			if (_tmp == null)
			{
				_tmp = new GameObject("tmp").transform;
				_tmp.SetParent(base.transform);
				_tmp.localPosition = Vector3.zero;
				_tmp.SetParent(base.transform.parent);
			}
			return _tmp;
		}
	}

	private void Update()
	{
		tmp.forward = frontWheel.position - rearWheel.position;
		_tmp.localRotation = Quaternion.Euler(_tmp.localRotation.eulerAngles.x, _tmp.parent.localRotation.eulerAngles.y, _tmp.parent.localRotation.eulerAngles.z);
		base.transform.localRotation = Quaternion.Lerp(base.transform.localRotation, _tmp.localRotation, Time.deltaTime * 15f);
	}
}
